          <!-- START OF MAINCOL -->
          <div class="MainCol AddEbookPage">
          	  <h1>编辑文章</h1>
              <span class="NormalFont SmallFont">
                  <?= CHtml::image(Yii::app()->baseUrl.'/images/home_icon.gif', '主页'); ?> > 文章管理 > 编辑文章
               </span><br /><br />
              <div class="Titlebox box"><!-- DON'T DELETE --></div>
              
              <?php if($post->hasErrors()):  echo CHtml::errorSummary($post); elseif(isPost()): ?>
              <div class="SuccessfulBox Smallbox">
                <span class="Successful"> 文章成功保存。查看文章点击<?php echo CHtml::link('这里', array('/posts/view', 'id' => $post->postId),  array('target' => '_blank')); ?>。</span>
              </div>
              <?php endif; ?>

              <?php if(Yii::app()->user->hasFlash('message')) : ?>
              <div class="SuccessfulBox Smallbox">
                <span class="Successful"> <?php echo Yii::app()->user->getFlash('message'); ?></span>
              </div>
              <?php endif; ?>

              <?= CHtml::form('', 'POST', array('name' => 'form1')); ?>
              <div class="Smallbox"><label>状态<span class="Red">*</span></label>
                  <?= CHtml::activeDropDownList($post, 'postStatus', Posts::getStatusOptions(), array('class' => 'TxtInput')); ?>
              </div>
              
              <div class="Smallbox"><label>标题<span class="Red">*</span></label>
                  <?= CHtml::activeTextField($post, 'postTitle', array('class' => 'TxtInput')); ?>
              </div>
              
              <div class="Smallbox"><label>来源
              </label>
                  <?= CHtml::activeTextField($post, 'postFrom', array('class' => 'TxtInput')); ?>
              </div>
              <div class="Smallbox"><label>话题</label>
              	  <?php $options = CHtml::listData($topics, 'termTaxonomyId', 'terms.name'); ?>
              	  <?= CHtml::activeDropDownList($post->hasTopic() ? $post->topics[0] : new TermsTaxonomy, 'termTaxonomyId', $options, array('class' => 'Select', 'name' => 'topic', 'empty' => '-- 请选择话题 --')); ?>
              </div>
              
              <div class="Smallbox"><label>分类<span class="Red">*</span></label>
              	  <select class="Select" name="category">
              	  	<option value="">-- 请选择分类 --</option>
              	  	<?php foreach($categories as $k => $category) : ?>
              	  	<optgroup label="<?= $category->terms->name; ?>">
              	  	<?php if(count($category->children) > 0) : ?>
              	  		<?php foreach($category->children as $subCategory) : ?>
              	  		<option value="<?= $subCategory->termTaxonomyId; ?>"<?php if($subCategory->termTaxonomyId == $post->categories[0]->termTaxonomyId) : ?> selected="selected"<?php endif; ?>><?= $subCategory->terms->name; ?></option>
              	  		<?php endforeach; ?>
              	  	<?php endif; ?>
              	  	</optgroup>
              	  	<?php endforeach; ?>
              	  </select>
              </div>

              <div class="Smallbox"><label>元关键字</label>
                  <?= CHtml::activeTextField($post, 'metaKey', array('class' => 'TxtInput')); ?>（请以半角逗号“,”分割关键字）
              </div>
              
              <div class="Smallbox"><label>元描述</label>
                  <?= CHtml::activeTextArea($post, 'metaDescr'); ?>
              </div>
              
              <div class="Smallbox"><label>&nbsp;</label>
                  	（对文章内容的简短描述）
              </div>
              
              <div class="Smallbox"><label>内容<span class="Red">*</span></label>
              <?php $this->widget('application.extensions.fckeditor.FCKEditorWidget',array(
				"model"=>$post,				# Data-Model
				"attribute"=>'postContent',			# Attribute in the Data-Model
				"height"=>'700px',
				"width"=>'100%',
				"toolbarSet"=>'Default', 			# EXISTING(!) Toolbar (see: fckeditor.js)
				"fckeditor"=>Yii::app()->basePath."/../assets/fckeditor/fckeditor.php",
												# Path to fckeditor.php
				"fckBasePath"=>Yii::app()->baseUrl."/assets/fckeditor/",
												# Realtive Path to the Editor (from Web-Root)
				"config" => array("EditorAreaCSS"=>Yii::app()->baseUrl.'/css/common.css',),
												# Additional Parameter (Can't configure a Toolbar dynamicly)
			) ); ?>
              </div>
              
              <div class="Midbox Red SmallFont">带 * 为必填项</div>
  

              <div class="Smallbox btnBox"><label>&nbsp;</label>
              	  <?= CHtml::submitButton('保存', array('title' => '保存', 'name' => 'submitPost')); ?>
                  或 <?= CHtml::link('返回', array('admin/posts')); ?>
                  <br class="clear" />
              </div>
              <?= CHtml::endForm(); ?>
              
              
          </div>
          <!-- END OF MAINCOL -->